package cn.song.module.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.song.mapper.TAdminMapper;
import cn.song.entity.TAdmin;
import cn.song.module.system.service.TAdminService;
import org.springframework.stereotype.Service;
import cn.song.common.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.song.utils.MybatisPlusUtil;

/**
 * 管理员(TAdmin)表服务实现类
 *
 * @author Song~
 * @since 2024-07-20 14:02:11
 */
@Service("tAdminService")
public class TAdminServiceImpl extends ServiceImpl<TAdminMapper, TAdmin> implements TAdminService {

    @Override
    public PageResult getPage(Integer currentPage, Integer size, TAdmin tAdmin) {
        Page<TAdmin> page = new Page<>(currentPage, size);

        QueryWrapper<TAdmin> queryWrapper = MybatisPlusUtil.queryWrapperBuilder(tAdmin);

        this.page(page, queryWrapper);

        return new PageResult((int) page.getTotal(), page.getRecords());
    }
}

